<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 联想小鑫
  Date: 2021/11/18
  Time: 17:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="js/jquery-1.8.2.min.js"></script>
    <link rel="stylesheet" href="css/img.css">
</head>
<body>
<form>
    编号: <input type="text" name="id" value="${param.id}" id="id"> <br>
    宿舍图片:<div class="photoUpLoad" >
    <input type="file"   class="photo" name="photo" accept="image/*"><span class="cross">+</span>
    <img src="" alt="" class="photoEcho">
</div>
    <br>
    楼号: <input type="text" name="floorno" id="floorname"> <br>
    宿舍号: <input type="text" name="dromno" id="dromno"> <br>
</form>
入住学生信息:
<table border="1">
    <tr>
        <td>编号</td>
        <td>姓名</td>
        <td>密码</td>
        <td>备注</td>
    </tr>
    <c:forEach items="${stu}" var="s">
        <tr>
            <td>${s.id}</td>
            <td>${s.name}</td>
            <td>${s.password}</td>
            <td>${s.mark}</td>
        </tr>
    </c:forEach>

</table>
</body>
<script>
    $(function () {
        $.ajax({
            async:false,
            url:"chakan.do",
            data:{"id":$("#id").val()},
            dataType:"json",
            type:"post",
            success:function (a) {
                console.log(a);
                $("#floorname").val(a[0].floorname);
                $("#dromno").val(a[0].dromno);
                $(".photoEcho").prop("src",a[0].picture);
            }
        })

    })
</script>
</html>
